/*
 * Calculadora.java
 *
 * Created on 14/02/2010, 06:04:17 PM
 */

package calcu;

/** *
 * @author LEONI
 */
public class Calculadora extends javax.swing.JFrame
{
 //variables
  double variable1;
  double variable2;
  double resultado;
  double posneg;

  //click de los botones
  int botonsuma;
  int botonresta;
  int botonmulti;
  int botondivi;
  int botondecimal;
  int botonxcuadrada;
  int botonxelevadoy;
  int botonseno;
  int botoncoseno;
  int botontangente;


    public Calculadora() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        Pantalla = new javax.swing.JTextField();
        numero7 = new javax.swing.JToggleButton();
        numero8 = new javax.swing.JToggleButton();
        numero9 = new javax.swing.JToggleButton();
        numero4 = new javax.swing.JToggleButton();
        numero5 = new javax.swing.JToggleButton();
        numero6 = new javax.swing.JToggleButton();
        numero1 = new javax.swing.JToggleButton();
        numero2 = new javax.swing.JToggleButton();
        numero3 = new javax.swing.JToggleButton();
        numero0 = new javax.swing.JToggleButton();
        puntodecimal = new javax.swing.JToggleButton();
        suma = new javax.swing.JToggleButton();
        resta = new javax.swing.JToggleButton();
        multiplicacion = new javax.swing.JToggleButton();
        division = new javax.swing.JToggleButton();
        limpiar = new javax.swing.JToggleButton();
        igual = new javax.swing.JToggleButton();
        masmenos = new javax.swing.JToggleButton();
        Pi = new javax.swing.JToggleButton();
        xcuadrada = new javax.swing.JToggleButton();
        xelevadoy = new javax.swing.JToggleButton();
        Seno = new javax.swing.JToggleButton();
        Coseno = new javax.swing.JToggleButton();
        Tangente = new javax.swing.JToggleButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("CALCULADORA TI");

        jPanel1.setBackground(new java.awt.Color(0, 0, 0));
        jPanel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 0, 153), 2, true));

        Pantalla.setEditable(false);
        Pantalla.setFont(new java.awt.Font("Comic Sans MS", 3, 14));
        Pantalla.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PantallaActionPerformed(evt);
            }
        });

        numero7.setBackground(new java.awt.Color(0, 0, 0));
        numero7.setFont(new java.awt.Font("Comic Sans MS", 3, 12)); // NOI18N
        numero7.setForeground(new java.awt.Color(255, 255, 255));
        numero7.setSelected(true);
        numero7.setText("A");
        numero7.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero7.setContentAreaFilled(false);
        numero7.setFocusPainted(false);
        numero7.setPreferredSize(new java.awt.Dimension(15, 25));
        numero7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero7ActionPerformed(evt);
            }
        });

        numero8.setBackground(new java.awt.Color(0, 0, 0));
        numero8.setFont(new java.awt.Font("Comic Sans MS", 3, 12)); // NOI18N
        numero8.setForeground(new java.awt.Color(255, 255, 255));
        numero8.setSelected(true);
        numero8.setText("BB");
        numero8.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero8.setContentAreaFilled(false);
        numero8.setFocusPainted(false);
        numero8.setPreferredSize(new java.awt.Dimension(15, 25));
        numero8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero8ActionPerformed(evt);
            }
        });

        numero9.setBackground(new java.awt.Color(0, 0, 0));
        numero9.setFont(new java.awt.Font("Comic Sans MS", 3, 12)); // NOI18N
        numero9.setForeground(new java.awt.Color(255, 255, 255));
        numero9.setSelected(true);
        numero9.setText("J");
        numero9.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero9.setContentAreaFilled(false);
        numero9.setFocusPainted(false);
        numero9.setPreferredSize(new java.awt.Dimension(15, 25));
        numero9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero9ActionPerformed(evt);
            }
        });

        numero4.setBackground(new java.awt.Color(0, 0, 0));
        numero4.setFont(new java.awt.Font("Comic Sans MS", 3, 12)); // NOI18N
        numero4.setForeground(new java.awt.Color(255, 255, 255));
        numero4.setSelected(true);
        numero4.setText("L");
        numero4.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero4.setContentAreaFilled(false);
        numero4.setFocusPainted(false);
        numero4.setPreferredSize(new java.awt.Dimension(15, 25));
        numero4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero4ActionPerformed(evt);
            }
        });

        numero5.setBackground(new java.awt.Color(0, 0, 0));
        numero5.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        numero5.setForeground(new java.awt.Color(255, 255, 255));
        numero5.setSelected(true);
        numero5.setText("5");
        numero5.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero5.setContentAreaFilled(false);
        numero5.setFocusPainted(false);
        numero5.setPreferredSize(new java.awt.Dimension(15, 25));
        numero5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero5ActionPerformed(evt);
            }
        });

        numero6.setBackground(new java.awt.Color(0, 0, 0));
        numero6.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        numero6.setForeground(new java.awt.Color(255, 255, 255));
        numero6.setSelected(true);
        numero6.setText("6");
        numero6.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero6.setContentAreaFilled(false);
        numero6.setFocusPainted(false);
        numero6.setPreferredSize(new java.awt.Dimension(15, 25));
        numero6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero6ActionPerformed(evt);
            }
        });

        numero1.setBackground(new java.awt.Color(0, 0, 0));
        numero1.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        numero1.setForeground(new java.awt.Color(255, 255, 255));
        numero1.setSelected(true);
        numero1.setText("1");
        numero1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero1.setContentAreaFilled(false);
        numero1.setFocusPainted(false);
        numero1.setPreferredSize(new java.awt.Dimension(15, 25));
        numero1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero1ActionPerformed(evt);
            }
        });

        numero2.setBackground(new java.awt.Color(0, 0, 0));
        numero2.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        numero2.setForeground(new java.awt.Color(255, 255, 255));
        numero2.setSelected(true);
        numero2.setText("2");
        numero2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero2.setContentAreaFilled(false);
        numero2.setFocusPainted(false);
        numero2.setPreferredSize(new java.awt.Dimension(15, 25));
        numero2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero2ActionPerformed(evt);
            }
        });

        numero3.setBackground(new java.awt.Color(0, 0, 0));
        numero3.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        numero3.setForeground(new java.awt.Color(255, 255, 255));
        numero3.setSelected(true);
        numero3.setText("3");
        numero3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero3.setContentAreaFilled(false);
        numero3.setFocusPainted(false);
        numero3.setPreferredSize(new java.awt.Dimension(15, 25));
        numero3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero3ActionPerformed(evt);
            }
        });

        numero0.setBackground(new java.awt.Color(0, 0, 0));
        numero0.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        numero0.setForeground(new java.awt.Color(255, 255, 255));
        numero0.setSelected(true);
        numero0.setText("0");
        numero0.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        numero0.setContentAreaFilled(false);
        numero0.setFocusPainted(false);
        numero0.setPreferredSize(new java.awt.Dimension(15, 25));
        numero0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numero0ActionPerformed(evt);
            }
        });

        puntodecimal.setBackground(new java.awt.Color(0, 0, 0));
        puntodecimal.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        puntodecimal.setForeground(new java.awt.Color(255, 255, 255));
        puntodecimal.setSelected(true);
        puntodecimal.setText(".");
        puntodecimal.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        puntodecimal.setContentAreaFilled(false);
        puntodecimal.setFocusPainted(false);
        puntodecimal.setMaximumSize(new java.awt.Dimension(13, 24));
        puntodecimal.setMinimumSize(new java.awt.Dimension(13, 24));
        puntodecimal.setPreferredSize(new java.awt.Dimension(15, 25));
        puntodecimal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                puntodecimalActionPerformed(evt);
            }
        });

        suma.setBackground(new java.awt.Color(0, 0, 0));
        suma.setFont(new java.awt.Font("Comic Sans MS", 3, 16));
        suma.setForeground(new java.awt.Color(255, 255, 255));
        suma.setSelected(true);
        suma.setText("+");
        suma.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 102, 102), 3, true));
        suma.setContentAreaFilled(false);
        suma.setFocusPainted(false);
        suma.setPreferredSize(new java.awt.Dimension(15, 25));
        suma.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sumaActionPerformed(evt);
            }
        });

        resta.setBackground(new java.awt.Color(0, 0, 0));
        resta.setFont(new java.awt.Font("Comic Sans MS", 3, 16));
        resta.setForeground(new java.awt.Color(255, 255, 255));
        resta.setSelected(true);
        resta.setText("-");
        resta.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 102, 102), 3, true));
        resta.setContentAreaFilled(false);
        resta.setFocusPainted(false);
        resta.setPreferredSize(new java.awt.Dimension(15, 25));
        resta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                restaActionPerformed(evt);
            }
        });

        multiplicacion.setBackground(new java.awt.Color(0, 0, 0));
        multiplicacion.setFont(new java.awt.Font("Comic Sans MS", 3, 16));
        multiplicacion.setForeground(new java.awt.Color(255, 255, 255));
        multiplicacion.setSelected(true);
        multiplicacion.setText("*");
        multiplicacion.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 102, 102), 3, true));
        multiplicacion.setContentAreaFilled(false);
        multiplicacion.setFocusPainted(false);
        multiplicacion.setMaximumSize(new java.awt.Dimension(16, 29));
        multiplicacion.setMinimumSize(new java.awt.Dimension(16, 29));
        multiplicacion.setPreferredSize(new java.awt.Dimension(15, 25));
        multiplicacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                multiplicacionActionPerformed(evt);
            }
        });

        division.setBackground(new java.awt.Color(0, 0, 0));
        division.setFont(new java.awt.Font("Comic Sans MS", 3, 16));
        division.setForeground(new java.awt.Color(255, 255, 255));
        division.setSelected(true);
        division.setText("/");
        division.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 102, 102), 3, true));
        division.setContentAreaFilled(false);
        division.setFocusPainted(false);
        division.setPreferredSize(new java.awt.Dimension(15, 25));
        division.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                divisionActionPerformed(evt);
            }
        });

        limpiar.setBackground(new java.awt.Color(0, 0, 0));
        limpiar.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        limpiar.setForeground(new java.awt.Color(255, 255, 255));
        limpiar.setSelected(true);
        limpiar.setText("C");
        limpiar.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 204, 255), 3, true));
        limpiar.setContentAreaFilled(false);
        limpiar.setFocusPainted(false);
        limpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                limpiarActionPerformed(evt);
            }
        });

        igual.setBackground(new java.awt.Color(0, 0, 0));
        igual.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        igual.setForeground(new java.awt.Color(255, 255, 255));
        igual.setSelected(true);
        igual.setText("=");
        igual.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 153, 255), 3, true));
        igual.setContentAreaFilled(false);
        igual.setFocusPainted(false);
        igual.setMaximumSize(new java.awt.Dimension(15, 25));
        igual.setMinimumSize(new java.awt.Dimension(15, 25));
        igual.setPreferredSize(new java.awt.Dimension(15, 25));
        igual.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                igualActionPerformed(evt);
            }
        });

        masmenos.setBackground(new java.awt.Color(0, 0, 0));
        masmenos.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        masmenos.setForeground(new java.awt.Color(255, 255, 255));
        masmenos.setSelected(true);
        masmenos.setText("+/-");
        masmenos.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 204, 255), 3, true));
        masmenos.setContentAreaFilled(false);
        masmenos.setFocusPainted(false);
        masmenos.setPreferredSize(new java.awt.Dimension(13, 24));
        masmenos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                masmenosActionPerformed(evt);
            }
        });

        Pi.setBackground(new java.awt.Color(0, 0, 0));
        Pi.setFont(new java.awt.Font("Comic Sans MS", 3, 16));
        Pi.setForeground(new java.awt.Color(255, 255, 255));
        Pi.setSelected(true);
        Pi.setText("Pi");
        Pi.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 0), 3, true));
        Pi.setContentAreaFilled(false);
        Pi.setFocusPainted(false);
        Pi.setPreferredSize(new java.awt.Dimension(35, 30));
        Pi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PiActionPerformed(evt);
            }
        });

        xcuadrada.setBackground(new java.awt.Color(0, 0, 0));
        xcuadrada.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        xcuadrada.setForeground(new java.awt.Color(255, 255, 255));
        xcuadrada.setSelected(true);
        xcuadrada.setText("X^2");
        xcuadrada.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 204, 255), 3, true));
        xcuadrada.setContentAreaFilled(false);
        xcuadrada.setFocusPainted(false);
        xcuadrada.setPreferredSize(new java.awt.Dimension(13, 24));
        xcuadrada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                xcuadradaActionPerformed(evt);
            }
        });

        xelevadoy.setBackground(new java.awt.Color(0, 0, 0));
        xelevadoy.setFont(new java.awt.Font("Comic Sans MS", 3, 12));
        xelevadoy.setForeground(new java.awt.Color(255, 255, 255));
        xelevadoy.setSelected(true);
        xelevadoy.setText("X^y");
        xelevadoy.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 204, 255), 3, true));
        xelevadoy.setContentAreaFilled(false);
        xelevadoy.setFocusPainted(false);
        xelevadoy.setPreferredSize(new java.awt.Dimension(13, 24));
        xelevadoy.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                xelevadoyActionPerformed(evt);
            }
        });

        Seno.setBackground(new java.awt.Color(0, 0, 0));
        Seno.setFont(new java.awt.Font("Comic Sans MS", 3, 16));
        Seno.setForeground(new java.awt.Color(255, 255, 255));
        Seno.setSelected(true);
        Seno.setText("Sen");
        Seno.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 0), 3, true));
        Seno.setContentAreaFilled(false);
        Seno.setFocusPainted(false);
        Seno.setPreferredSize(new java.awt.Dimension(35, 30));
        Seno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SenoActionPerformed(evt);
            }
        });

        Coseno.setBackground(new java.awt.Color(0, 0, 0));
        Coseno.setFont(new java.awt.Font("Comic Sans MS", 3, 16));
        Coseno.setForeground(new java.awt.Color(255, 255, 255));
        Coseno.setSelected(true);
        Coseno.setText("Cos");
        Coseno.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 0), 3, true));
        Coseno.setContentAreaFilled(false);
        Coseno.setFocusPainted(false);
        Coseno.setMaximumSize(new java.awt.Dimension(34, 29));
        Coseno.setMinimumSize(new java.awt.Dimension(34, 29));
        Coseno.setPreferredSize(new java.awt.Dimension(35, 30));
        Coseno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CosenoActionPerformed(evt);
            }
        });

        Tangente.setBackground(new java.awt.Color(0, 0, 0));
        Tangente.setFont(new java.awt.Font("Comic Sans MS", 3, 16));
        Tangente.setForeground(new java.awt.Color(255, 255, 255));
        Tangente.setSelected(true);
        Tangente.setText("Tan");
        Tangente.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 0), 3, true));
        Tangente.setContentAreaFilled(false);
        Tangente.setFocusPainted(false);
        Tangente.setPreferredSize(new java.awt.Dimension(35, 30));
        Tangente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TangenteActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Comic Sans MS", 3, 18));
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("CALCULADORA TI-NOSPIRE");

        jLabel2.setBackground(new java.awt.Color(0, 0, 0));
        jLabel2.setFont(new java.awt.Font("Monospaced", 2, 8));
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("L.G.L.");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(57, 57, 57)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addComponent(numero4, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(numero5, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(numero6, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(resta, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(Coseno, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addComponent(numero1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(numero2, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(numero3, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(multiplicacion, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(Tangente, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addComponent(numero7, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(numero8, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(numero9, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(suma, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(Seno, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addComponent(numero0, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(puntodecimal, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(igual, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(division, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(Pi, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(Pantalla, javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                            .addComponent(limpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(xcuadrada, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(xelevadoy, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(masmenos, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(42, 42, 42))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(342, 342, 342)
                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(32, 32, 32))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addComponent(Pantalla, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(limpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(masmenos, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(xelevadoy, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(xcuadrada, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(numero7, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(numero8, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(numero9, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(suma, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Seno, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(numero4, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(numero5, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(numero6, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(resta, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Coseno, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Tangente, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(multiplicacion, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(numero3, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(numero2, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(numero1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(puntodecimal, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(igual, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(division, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(numero0, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(Pi, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 14, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void numero7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero7ActionPerformed
       // Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero7.getText());
    }//GEN-LAST:event_numero7ActionPerformed

    private void numero8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero8ActionPerformed
       // Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero8.getText());
    }//GEN-LAST:event_numero8ActionPerformed

    private void numero9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero9ActionPerformed
       // Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero9.getText());
    }//GEN-LAST:event_numero9ActionPerformed

    private void numero4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero4ActionPerformed
        //Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero4.getText());
    }//GEN-LAST:event_numero4ActionPerformed

    private void numero5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero5ActionPerformed
        //Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero5.getText());
    }//GEN-LAST:event_numero5ActionPerformed

    private void numero6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero6ActionPerformed
        //Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero6.getText());
    }//GEN-LAST:event_numero6ActionPerformed

    private void numero1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero1ActionPerformed
        //Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero1.getText());
    }//GEN-LAST:event_numero1ActionPerformed

    private void numero2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero2ActionPerformed
        // Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero2.getText());

    }//GEN-LAST:event_numero2ActionPerformed

    private void numero3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero3ActionPerformed
        //Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero3.getText());
    }//GEN-LAST:event_numero3ActionPerformed

    private void numero0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numero0ActionPerformed
        //Pantalla.setText("");
        Pantalla.setText(Pantalla.getText()+numero0.getText());
    }//GEN-LAST:event_numero0ActionPerformed

    private void puntodecimalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_puntodecimalActionPerformed
       if(botondecimal==0)
       {
         Pantalla.setText(Pantalla.getText()+puntodecimal.getText());
         botondecimal=1;
       }
    }//GEN-LAST:event_puntodecimalActionPerformed

    private void sumaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sumaActionPerformed
      variable1=(Double.parseDouble(String.valueOf(Pantalla.getText())));
      Pantalla.setText("");
      botonsuma=1;
      botondecimal=0;
    }//GEN-LAST:event_sumaActionPerformed

    private void restaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restaActionPerformed
      variable1=(Double.parseDouble(String.valueOf(Pantalla.getText())));
      Pantalla.setText("");
      botonresta=1;
      botondecimal=0;
    }//GEN-LAST:event_restaActionPerformed

    private void multiplicacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiplicacionActionPerformed
      variable1=(Double.parseDouble(String.valueOf(Pantalla.getText())));
      Pantalla.setText("");
      botonmulti=1;
      botondecimal=0;
    }//GEN-LAST:event_multiplicacionActionPerformed

    private void divisionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_divisionActionPerformed
      variable1=(Double.parseDouble(String.valueOf(Pantalla.getText())));
      Pantalla.setText("");
      botondivi=1;
      botondecimal=0;
    }//GEN-LAST:event_divisionActionPerformed

    private void limpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_limpiarActionPerformed
        Pantalla.setText("");
        botondecimal=0;
    }//GEN-LAST:event_limpiarActionPerformed

    private void masmenosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_masmenosActionPerformed
      posneg=(Double.parseDouble(String.valueOf(Pantalla.getText())));
      posneg=posneg*(-1);
      Pantalla.setText(String.valueOf(posneg));
    }//GEN-LAST:event_masmenosActionPerformed

    private void igualActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_igualActionPerformed
        variable2=(Double.parseDouble(String.valueOf(Pantalla.getText())));
        
        if(botonsuma>0)
         {
           resultado=variable1+variable2;
           Pantalla.setText((String.valueOf(resultado)));
           variable1=0;
           variable2=0;
           botonsuma=0;
         }

        if(botonresta>0)
         {
           resultado=variable1-variable2;
           Pantalla.setText((String.valueOf(resultado)));
           variable1=0;
           variable2=0;
           botonresta=0;
         }

        if(botonmulti>0)
        {
           resultado=variable1*variable2;
           Pantalla.setText((String.valueOf(resultado)));
           variable1=0;
           variable2=0;
           botonmulti=0;
        }

        if(botondivi>0)
        {
           resultado=variable1/variable2;
           Pantalla.setText((String.valueOf(resultado)));
           variable1=0;
           variable2=0;
           botondivi=0;
        }

        if(botonxelevadoy>0)
        {
           resultado=Math.pow(variable1, variable2);
           Pantalla.setText((String.valueOf(resultado)));
           variable1=0;
           variable2=0;
           botonxelevadoy=0;
        }

        
        
    }//GEN-LAST:event_igualActionPerformed

    private void PantallaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PantallaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_PantallaActionPerformed

    private void PiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PiActionPerformed
        Pantalla.setText("3.1416");
    }//GEN-LAST:event_PiActionPerformed

    private void xcuadradaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_xcuadradaActionPerformed
        variable1=(Double.parseDouble(String.valueOf(Pantalla.getText())));
        botonxcuadrada=1;
        botondecimal=0;

        if(botonxcuadrada>0)
        {
           resultado=variable1*variable1;
           Pantalla.setText((String.valueOf(resultado)));
           variable1=0;
           botonxcuadrada=0;
        }
    }//GEN-LAST:event_xcuadradaActionPerformed

    private void xelevadoyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_xelevadoyActionPerformed
        variable1=(Double.parseDouble(String.valueOf(Pantalla.getText())));
        Pantalla.setText("");
        botonxelevadoy=1;
        botondecimal=0;
    }//GEN-LAST:event_xelevadoyActionPerformed

    private void SenoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SenoActionPerformed
        variable1=(Double.parseDouble(String.valueOf(Pantalla.getText())));
        botonseno=1;
        botondecimal=0;

        if(botonseno>0)
        {
           resultado=Math.sin(variable1);
           Pantalla.setText((String.valueOf(resultado)));
           variable1=0;
           botonseno=0;
        }
    }//GEN-LAST:event_SenoActionPerformed

    private void CosenoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CosenoActionPerformed
        variable1=(Double.parseDouble(String.valueOf(Pantalla.getText())));
        botoncoseno=1;
        botondecimal=0;

        if(botoncoseno>0)
        {
           resultado=Math.cos(variable1);
           Pantalla.setText((String.valueOf(resultado)));
           variable1=0;
           botoncoseno=0;
        }
    }//GEN-LAST:event_CosenoActionPerformed

    private void TangenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TangenteActionPerformed
        variable1=(Double.parseDouble(String.valueOf(Pantalla.getText())));
        botontangente=1;
        botondecimal=0;

        if(botontangente>0)
        {
           resultado=Math.tan(variable1);
           Pantalla.setText((String.valueOf(resultado)));
           variable1=0;
           botontangente=0;
        }
    }//GEN-LAST:event_TangenteActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Calculadora().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToggleButton Coseno;
    private javax.swing.JTextField Pantalla;
    private javax.swing.JToggleButton Pi;
    private javax.swing.JToggleButton Seno;
    private javax.swing.JToggleButton Tangente;
    private javax.swing.JToggleButton division;
    private javax.swing.JToggleButton igual;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JToggleButton limpiar;
    private javax.swing.JToggleButton masmenos;
    private javax.swing.JToggleButton multiplicacion;
    private javax.swing.JToggleButton numero0;
    private javax.swing.JToggleButton numero1;
    private javax.swing.JToggleButton numero2;
    private javax.swing.JToggleButton numero3;
    private javax.swing.JToggleButton numero4;
    private javax.swing.JToggleButton numero5;
    private javax.swing.JToggleButton numero6;
    private javax.swing.JToggleButton numero7;
    private javax.swing.JToggleButton numero8;
    private javax.swing.JToggleButton numero9;
    private javax.swing.JToggleButton puntodecimal;
    private javax.swing.JToggleButton resta;
    private javax.swing.JToggleButton suma;
    private javax.swing.JToggleButton xcuadrada;
    private javax.swing.JToggleButton xelevadoy;
    // End of variables declaration//GEN-END:variables



}
